package src.com.atguigu03._throws;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * ClassName: OverrideTest
 * Package: src.com.atguigu03._throws
 * Description:
 *
 * @Author BuTang
 * @Create 2023/5/4 13:54
 * @Version 1.0
 */
public class OverrideTest {
    public static void main(String[] args) {
        Father f = new Son();
        try {
            f.method1();
        }catch (IOException e){
            e.printStackTrace();
        }
        Number n = f.method4();
    }

}
class Father{
    public void method1()throws IOException {}
    public void method2(){}
    public void method3(){}
    public Number method4(){return null;}
}

class Son extends Father{


    @Override
    public void method1() throws FileNotFoundException {}

//    @Override
//    public void method2() throws IOException{
//    }

    @Override
    public void method3() throws RuntimeException{}//父类中没有throws异常的时候，运行时异常是可以在子类中写的

    @Override
    public Integer method4() {
        return null;
    }
}